<%--
  Created by IntelliJ IDEA.
  User: 83260
  Date: 2019/1/14
  Time: 16:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>$Title$</title>
    <script src="js/jquery-3.3.1.min.js"></script>
  </head>
  <body>
        <script>
            $.get("provinceServlet",{},function (data) {
                //[{"id":1,"name":"北京"},{"id":2,"name":"上海"},{"id":3,"name":"广州"},{"id":4,"name":"陕西"}
                //查看json可知格式是这种数组的形式加对象的形式
                for(var i = 0 ;i < data.length ; i++) {
                    $("#province").append("<option value='"+data[i].name+"'>"+data[i].name+"</option>")

                }

            },"json")
        </script>
      <select id="province">
          <option >---请选择省份---</option>
      </select>
  </body>
</html>
